More metadata about options
authorparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 30 Nov 2004 16:16:23 +0000 (16:16 +0000)
committerparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 30 Nov 2004 16:16:23 +0000 (16:16 +0000)
gpsbabel/defs.h
gpsbabel/duplicate.c
gpsbabel/stackfilter.c

index 32f895f1587a8c3f163eb66a5aae58851c471248..5f008e1ec48bbfc5029586aad45ccbc88912ffcd 100644 (file)
@@ -322,15 +322,36 @@ void      vmem_free(vmem_t*);
 void   vmem_realloc(vmem_t*, size_t);
 
 
-#define ARGTYPE_UNKNOWN  0
-#define ARGTYPE_INT      0x00000001
-#define ARGTYPE_FLOAT    0x00000002
-#define ARGTYPE_STRING   0x00000003
-#define ARGTYPE_BOOL     0x00000004
-#define ARGTYPE_FILE     0x00000005
-#define ARGTYPE_OUTFILE  0x00000006
-#define ARGTYPE_REQUIRED 0x40000000
-#define ARGTYPE_HIDDEN   0x20000000
+#define ARGTYPE_UNKNOWN    0x00000000
+#define ARGTYPE_INT        0x00000001
+#define ARGTYPE_FLOAT      0x00000002
+#define ARGTYPE_STRING     0x00000003
+#define ARGTYPE_BOOL       0x00000004
+#define ARGTYPE_FILE       0x00000005
+#define ARGTYPE_OUTFILE    0x00000006
+
+/* REQUIRED means that the option is required to be set. 
+ * See also BEGIN/END_REQ */
+#define ARGTYPE_REQUIRED   0x40000000
+
+/* HIDDEN means that the option does not appear in help texts.  Useful
+ * for debugging or testing options */
+#define ARGTYPE_HIDDEN     0x20000000
+
+/* BEGIN/END_EXCL mark the beginning and end of an exclusive range of
+ * options. No more than one of the options in the range may be selected 
+ * or set. If exactly one must be set, use with BEGIN/END_REQ
+ * Both of these flags set is just like neither set, so avoid doing that. */
+#define ARGTYPE_BEGIN_EXCL 0x10000000
+#define ARGTYPE_END_EXCL   0x08000000
+
+/* BEGIN/END_REQ mark the beginning and end of a required range of 
+ * options.  One or more of the options in the range MUST be selected or set.
+ * If exactly one must be set, use with BEGIN/END_EXCL 
+ * Both of these flags set is synonymous with REQUIRED, so use that instead
+ * for "groups" of exactly one option. */
+#define ARGTYPE_BEGIN_REQ  0x04000000
+#define ARGTYPE_END_REQ    0x02000000 
 
 #define ARGTYPE_TYPEMASK 0x00000fff
 #define ARGTYPE_FLAGMASK 0xfffff000
index 321834754e3621cced845f9d185989d0959656aa..5556be28ee73bef21e17f8b11bf97d3afcf3bd8d 100644 (file)
@@ -31,9 +31,9 @@ static char *correct_coords = NULL;
 static
 arglist_t dup_args[] = {
        {"shortname", &snopt, "Suppress duplicate waypoints based on name",
-               NULL, ARGTYPE_BOOL},
+               NULL, ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL},
        {"location", &lcopt, "Suppress duplicate waypoint based on coords",
-               NULL, ARGTYPE_BOOL},
+               NULL, ARGTYPE_END_REQ | ARGTYPE_BOOL},
        {"all", &purge_duplicates, "Suppress all instances of duplicates",
                NULL, ARGTYPE_BOOL},
        {"correct", &correct_coords, "Use coords from duplicate points", 
index d9a82d98a985c8d5f90320093cc9c08497ba4ec2..adb3a91444ef6ab1cac55f4b603bb697caad8367 100644 (file)
@@ -40,22 +40,23 @@ static int  swapdepth = 0;
 static
 arglist_t stackfilt_args[] = {
        {"push", &opt_push, "Push waypoint list onto stack", NULL, 
-               ARGTYPE_BOOL},
-       {"copy", &opt_copy, "Copy waypoint list when pushing", NULL,
-               ARGTYPE_BOOL},
+               ARGTYPE_BEGIN_EXCL | ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL},
        {"pop", &opt_pop, "Pop waypoint list from stack", NULL,
                ARGTYPE_BOOL},
-       {"append", &opt_append, "Append list when popping", NULL,
-               ARGTYPE_BOOL},
-       {"discard", &opt_discard, "Discard top of stack when popping", 
-               NULL, ARGTYPE_BOOL},
-       {"replace", &opt_replace, "Replace list with top of stack (default)", 
-               NULL, ARGTYPE_BOOL},
        {"swap", &opt_swap, "Swap waypoint list with <depth> item on stack", 
+               NULL, ARGTYPE_END_EXCL | ARGTYPE_END_REQ | ARGTYPE_BOOL},
+       {"copy", &opt_copy, "(push) Copy waypoint list", NULL,
+               ARGTYPE_BOOL},
+       {"append", &opt_append, "(pop) Append list", NULL,
+               ARGTYPE_BEGIN_EXCL | ARGTYPE_BOOL},
+       {"discard", &opt_discard, "(pop) Discard top of stack", 
                NULL, ARGTYPE_BOOL},
-       {"depth", &opt_depth, "Item to use when swapping", NULL, ARGTYPE_INT},
+       {"replace", &opt_replace, "(pop) Replace list (default)", 
+               NULL, ARGTYPE_END_EXCL | ARGTYPE_BOOL},
+       {"depth", &opt_depth, "(swap) Item to use (default=1)", 
+               NULL, ARGTYPE_INT},
        {"nowarn", &nowarn, "Suppress cleanup warning", NULL, 
-               ARGTYPE_INT | ARGTYPE_HIDDEN},
+               ARGTYPE_BOOL | ARGTYPE_HIDDEN},
        {0, 0, 0, 0, 0}
 };